Nonvolatile memory

ABSTRACT

It is aimed to detect, notify, and save an abnormal area in semiconductor memory for greatly improving reliability. An inside of semiconductor memories provided for a memory card comprises a user area, a substitution area, an area substitution information storage area, and a management area. An inside of semiconductor memories comprises a user area, a substitution area, and a management area. The user area is a data area a user can use. The substitution area is substituted when an error occurs in the user area. The area substitution information storage area stores area substitution area information. The management area stores substitution information. The information processing section performs substitution on two levels as follows. When detecting an operation indicating a symptom of failure in a semiconductor memory area, the information processing section performs area substitution during an idle state of the memory card. When detecting a faulty operation in an area, the information processing section immediately performs area substitution.

BACKGROUND OF THE INVENTION

[0001] The present invention relates to a technology for improving reliability of a storage device. More specifically, the present invention relates to a technology effectively applied to data saving in a storage device comprising nonvolatile semiconductor memory.

[0002] Memory cards have rapidly spread as a storage device for personal computers and multifunctional terminals. With increasing demands for high performance in recent years, for example, flash memory is used as semiconductor memory installed in a memory card. The flash memory is capable of electrically erasing and rewriting data and storing a large amount of data without using a battery.

[0003] When the semiconductor memory malfunctions, some memory cards allow the faulty semiconductor memory to be replaced by an alternative semiconductor memory for preventing the memory card from being unusable (e.g., see patent document 1).

[0004] [Patent Document 1]

[0005] Japanese Unexamined Patent Publication No. Hei 3(1991)-191450

SUMMARY OF THE INVENTION

[0006] However, the inventors found the following problem in the above-mentioned technology as a countermeasure against faulty memory cards.

[0007] That is to say, the problem is incapability to ensure data at faulty locations. This is because of the ex-post countermeasure of replacing the failed semiconductor memory with an alternative semiconductor memory instead of replacing the semiconductor memory to become faulty with an alternative semiconductor memory in advance.

[0008] It is therefore an object of the present invention to provide a storage device capable of detecting, notifying, and saving an abnormal area in semiconductor memory and greatly improving the reliability.

[0009] These and other objects and novel features of the invention may be readily ascertained by referring to the following description and appended drawings.

[0010] The following outlines major aspects of the present invention disclosed in this application.

[0011] A storage device according to the present invention comprises one or more semiconductor memories and an information processing section which reads data stored in the one or more semiconductor memories based on an operating program and instructs a predetermined process and an operation to write data. The information processing section detects a state of an area in the semiconductor memory. The information processing section substitutes the area during an idle state causing no operations in the storage device when the area is assumed to be a critical state. The information processing section substitutes the area immediately when the area is assumed to be a limit state.

BRIEF DESCRIPTION OF THE DRAWINGS

[0012]FIG. 1 is a block diagram of a memory card according to an embodiment of the present invention;

[0013]FIG. 2 is a block diagram of an information processing section provided for the memory card in FIG. 1;

[0014]FIG. 3 is a configuration diagram of an area substitution table stored in each area substitution information storage area of the semiconductor memory provided for the memory card in FIG. 1;

[0015]FIG. 4 is an explanatory diagram exemplifying status flags and contents thereof in the area substitution table stored in the area substitution information storage area of the semiconductor memory in FIG. 1;

[0016]FIG. 5 is an explanatory diagram exemplifying area substitution factors for area substitution information in FIG. 4;

[0017]FIG. 6 is a flowchart describing a reset process and an initialization process after a power-on sequence for the memory card in FIG. 1;

[0018]FIG. 7 is an explanatory diagram for state transition in the area substitution table stored in an MPU work area provided for the memory card in FIG. 1;

[0019]FIG. 8 is a flowchart describing a command process for the memory card in FIG. 1;

[0020]FIG. 9 is a flowchart describing a command process for the memory card in an emergency condition in FIG. 1;

[0021]FIG. 10 is a flowchart describing a command process during IDLE execution for the memory card in FIG. 1;

[0022]FIG. 11 is a flowchart describing an IDLE execution process for the memory card in FIG. 1;

[0023]FIG. 12 an explanatory diagram for the area substitution in-process history of the memory card in FIG. 1;

[0024]FIG. 13 is a flowchart describing an area substitution for the memory card in FIG. 1;

[0025]FIG. 14 is a block diagram of the memory card according to another embodiment of the present invention;

[0026]FIG. 15 is an explanatory diagram exemplifying a system configuration for managing area substitution information via a network according to another embodiment of the present invention; and

[0027]FIG. 16 is a block diagram of the storage device according to another embodiment of the present invention.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0028] Embodiments of the present invention will be described in further detail with reference to the accompanying drawings.

[0029]FIG. 1 is a block diagram of a memory card according to an embodiment of the present invention. FIG. 2 is a block diagram of an information processing section provided for the memory card in FIG. 1. FIG. 3 is a configuration diagram of an area substitution table stored in each area substitution information storage area of the semiconductor memory provided for the memory card in FIG. 1. FIG. 4 is an explanatory diagram exemplifying status flags and contents thereof in the area substitution table stored in the area substitution information storage area of the semiconductor memory in FIG. 1. FIG. 5 is an explanatory diagram exemplifying area substitution factors for area substitution in FIG. 4. FIG. 6 is a flowchart describing a reset process and an initialization process after a power-on sequence for the memory card in FIG. 1. FIG. 7 is an explanatory diagram for state transition in the area substitution table stored in an MPU work area provided for the memory card in FIG. 1. FIG. 8 is a flowchart describing a command process for the memory card in FIG. 1. FIG. 9 is a flowchart describing a command process for the memory card in an emergency condition in FIG. 1. FIG. 10 is a flowchart describing a command process during IDLE execution for the memory card in FIG. 1. FIG. 11 is a flowchart describing an IDLE execution process for the memory card in FIG. 1. FIG. 12 an explanatory diagram for the area substitution in-process history of the memory card in FIG. 1. FIG. 13 is a flow chart describing an area substitution for the memory card in FIG. 1.

[0030] According to the embodiment, a memory card (storage device) 1 represents, e.g., a flash memory card and is used as an external storage medium for personal computers and multifunctional terminals as hosts.

[0031] The host just needs to access data using predetermined protocols such as ATA (AT Attachment), CF, and SCSI (Small Computer System Interface).

[0032] As shown in FIG. 1, the memory card 1 comprises an information processing section 2 and a storage section 3. The storage section 3 comprises, e.g., five semiconductor memories 3 ₁ through 3 ₅. For example, the semiconductor memories 3 ₁ through 3 ₅ comprise flash memories.

[0033] The information processing section 2 and the semiconductor memories 3 ₁ through 3 ₅ are connected to each other via a data/address bus B and a signal line bus SL.

[0034] The information processing section 2 reads programs or data stored in the semiconductor memories 3 ₁ through 3 ₅ based on an operating program for performing predetermined processes and instructing to write data. In addition, the information processing section 2 detects an abnormal area in the storage section 3 and notifies or saves it.

[0035] Each area will be described below.

[0036] Each of the semiconductor memories 3 ₁ through 3 ₅ is provided with a memory mat comprising a plurality of sectors. There is provided a control section to control the memory mat. The control section comprises an individual control section (individual peripheral circuit) to control a specific sector and a common control section to provide control irrespective of sector locations.

[0037] In this case, the memory mat employs a unit area, i.e., an area (physical area) controlled by each individual control section. Consequently, performing an area substitution enables substitution including the individual control section.

[0038] Instead of the above-mentioned area setting, one area may correspond to each semiconductor memory, or a bank if the semiconductor memory is provided with a plurality of banks.

[0039] The following describes the circuit configuration of the information processing section 2.

[0040] As shown in FIG. 2, the information processing section 2 comprises an external device connection section 4, an MPU 5, a detection section 6, a notification section 7, an area substitution processing section 8, an area decode management section 9, a buffer control section 10, RAM (Random Access Memory) 11, and an interface section 12.

[0041] According to this configuration, the information processing section 2 is provided with such functional blocks as the detection section 6, the notification section 7, the area substitution processing section 8, and the area decode management section 9. Instead of providing the information processing section 2 with the functional blocks, however, the MPU 5 may implement the equivalent functions by means of software processing, for example.

[0042] The external device connection section 4, the MPU 5, the detection section 6, the notification section 7, the area substitution processing section 8, the area decode management section 9, the buffer control section 10, the RAM 11, and the interface section are connected to each other via internal buses.

[0043] The external device connection section 4 works as an interface with the host. Based on operating programs, the MPU (Microprocessing Unit) 5 not only reads programs and data stored in the semiconductor memories 3 ₁ through 3 ₅ to perform predetermined processes, but also instructs to write data.

[0044] The detection section 6 detects an abnormal area. Based on a result detected by the detection section 6, the notification section 7 notifies occurrence of the abnormal area to the host and the like. The area substitution processing section 8 controls substitution processing of the abnormal area.

[0045] The area decode management section 9 is responsible for management such as allowing or disallowing access to any area. The buffer control section 10 controls the RAM 11. The RAM 11 is memory used as a data buffer for temporarily storing data of the storage section 3. The interface section 12 functions as an interface with the storage section 3.

[0046] The following describes the internal configuration of the semiconductor memories 3 ₁ through 3 ₅.

[0047] As shown in FIG. 1, the semiconductor memories 3 ₁ and 3 ₂ comprise a user area, a substitution area, an area substitution information storage area, and a management area. The semiconductor memories 3 ₃ through 3 ₆ comprise a user area, a substitution area, and a management area.

[0048] The user area is a data area a user can use. The substitution area substitutes for the user area if it fails. The area substitution information storage area stores area substitution area information. The management area stores substitution information for managing the substitution area.

[0049] The semiconductor memories 3 ₁ and 3 ₂ each are provided with the area substitution information storage area for ensuring data by multiplexing. The area substitution information storage area can be provided for not only the semiconductor memories 3 ₁ and 3 ₂, but also any or all of the semiconductor memories 3 ₃ through 3 ₅ for more safely maintaining data.

[0050]FIG. 3 shows a configuration of the area substitution table to be store in each area substitution information storage area of the semiconductor memories 3 ₁ and 3 ₂. The area substitution table comprises a status flag, a substitution factor, a substitution origin, and a substitution destination. The status flag indicates a substitute area state. FIG. 4 exemplifies status flags in the area substitution table and contents of the status flags. As shown in FIG. 4, the area substitution table provides various contents such as “Normal (unused)”, “Normal (used)”, and “Area substitution completed; substitution origin” corresponding to the status flags.

[0051] The substitution factor shows the cause of area substitution. The substitution origin shows a physical area number of a substitution origin. The substitution destination shows a physical area number of a substitution destination.

[0052] The area substitution table is formed correspondingly to each of areas (area Nos. 1 through 5) for the semiconductor memories 3 ₁ through 3 ₅. A unit of five area substitution tables is provided with a redundant area for form one set.

[0053] The redundant area is used to add an ECC (Error Correcting Code) redundant code that protects data. The redundant area may be omissible.

[0054]FIG. 5 exemplifies area substitution factors.

[0055]FIG. 5 shows, from the left to the right, an area substitution factor, and a flag, a limit value, a critical value, and necessity of a retry process corresponding to the contents of the area substitution factor.

[0056] The area substitution factor includes: a substitute free area indicating the number of blocks for a free area in the semiconductor memory; a successive retry error; an ECC uncorrectable error at retention failure; a Device/Manufacture Code unreadable error (device code error); and a physical amount.

[0057] The successive retry error includes: a successive program error; an overwrite error; and a retention failure (verify check error). The physical amount includes: an erasure/program time; the number of erasures; a read current value; a write current value; and an externally supplied power/current value.

[0058] Each of the area substitution factors is assigned the limit value and the critical value. The limit value (limit state) indicates that the area is unusable and needs to be substituted immediately. The critical value (critical state) indicates that the area is usable but is critical, requiring gradual substitution.

[0059] As an area substitution factor, for example, the ‘successive program error’ of the ‘successive retry error’ is assigned the limit value set to 260 or more and the critical value set to 10 or more.

[0060] The following describes operations of the memory card 1 according to the embodiment.

[0061] First, a flowchart in FIG. 6 is used to describe a reset process and an initialization process after a power-on sequence for the memory card 1.

[0062] The power is turned on to release the reset state (step S101). The system information in the semiconductor memories 3 ₁ through 3 ₅ is downloaded to work areas such as RAM provided for the MPU 5 (step S102).

[0063] The MPU 5 references the area substitution information stored in the area substitution information storage area of the semiconductor memory 3 ₁ (or the semiconductor memory 3 ₂) and downloads the system information except the faulty semiconductor memory.

[0064] Thereafter, the detection section 6 performs a device check for the semiconductor memories 3 ₁ through 3 ₅ in the storage section 3 (step S103). The detection section 6 then checks whether or not the limit value for area substitution is exceeded (step S104).

[0065] When the limit value for area substitution is exceeded at step S104, the area decode management section 9 sets the status flag to indicate an emergency condition and updates the area substitution information in the work area of the MPU 5 (step S105). This allows the status flag in the area substitution table to indicate occurrence of an emergency condition (see FIG. 4).

[0066] Based on the updated area substitution information, the MPU 5 creates a management information table (step S106) and stores it in the work area of the MPU 5. The MPU 5 then performs a process for faulty area detection (step S107).

[0067] When the limit value for area substitution is not exceeded at step S104, the detection section 6 checks whether or not the critical value for the area substitution is exceeded (step S108).

[0068] When the critical value is exceeded, the area decode management section 9 updates the area substitution information (step S109) so that the status flag in the area substitution table indicates occurrence of the IDLE execution (FIG. 4).

[0069] When the critical value is not exceeded at step S108, the MPU 5 checks whether or not an error occurs in the semiconductor memory (step S110). If no error occurs, the MPU creates the management information table (step S111) and stores in the work area thereof to execute normal processing (step S112).

[0070] When an error occurs in the process at step S110, the MPU 5 executes an error process (step S113).

[0071]FIG. 7 diagrams state transition in the area substitution table stored in the work area of the MPU 5 due to the area substitution. Here, it is assumed that area numbers No. 1 through No. 3 are busy and that area numbers No. 4 and No. 5 correspond to substitute areas.

[0072] In FIG. 7, the area substitution table stored in the work area is equivalent to the configuration of the area substitution table in FIG. 3 except the redundant area. The remaining part of the configuration is unchanged, i.e., comprising the status flag, the substitution factor, the substitution origin, and the substitution destination.

[0073] For example, when an ECC unrecoverable error occurs due to faulty retention in the area with area number No. 1, the area substitution table for area number No. 1 will contain the status flag set to ‘21h’ (FIG. 4) and the substitution factor set to ‘5h’ (FIG. 5).

[0074] When the area with area number No. 1 is substituted for that with area number No. 4, the area substitution table for area number No. 1 will contain the status flag set to ‘08h’ (FIG. 4) indicating completion of the area substitution and the substitution destination set to ‘04h’ indicating the area number of the substitution destination.

[0075] The area substitution table for area number No. 4, will contain the status flag set to ‘09h’ (FIG. 4) indicating completion of the area substitution and the substitution origin set to ‘01h’ indicating the area number of the substitution origin.

[0076] When the detection section 6 detects that the critical value exceeds in the substitute free area with area number No. 4, the area substitution table for area number No.4 will contain the status flag set to ‘C1h’ (FIG. 4) and the substitution factor set to ‘1h’ (FIG. 5).

[0077] Here, the area with area number No. 4 is substituted for that with area number No. 5. The area substitution is performed during an idle time of the memory card 1. That is to say, the area substitution is performed in the background during an idle state in which no process takes place. The following description uses the term “IDLE execution” to express that the semiconductor memory executes the area substitution during an idle state.

[0078] During an IDLE execution period, the area substitution table for area number No. 4 will contain the status flag set to ‘C2h’ (FIG. 4) indicating the IDLE execution in process and the substitution destination set to ‘05h’ indicating the area number of the substitution destination.

[0079] The area substitution table with area number No. 5 will contain the status flag set to ‘C3h’ (FIG. 4) indicating the IDLE execution in process and substitution origin set to ‘04h’ indicating the area number of the substitution origin.

[0080] When the area substitution terminates thereafter, the area substitution table with area number No. 4 will contain the status flag set to ‘0Eh’ (FIG. 4) indicating completion of the IDLE execution. The area substitution table with area number No. 5 will contain the status flag set to 0Fh’ (FIG. 4) indicating completion of the IDLE execution.

[0081] When the substituted area number No. 5 is subject to an emergency condition (an ECC uncorrectable error due to faulty retention), the area substitution table for area number No. 5 will contain the status flag set to ‘31h’ (FIG. 4) and the substitution factor set to ‘5h’ (FIG. 5).

[0082] In this case, the area numbers Nos. 4 and 5 are already used as substitute areas. Accordingly, the area substitution table for area number No. 5 will contain the status flag set to ‘FFh’ (FIG. 4) indicating substitute area exhaustion, i.e., termination of the substitution.

[0083] The following describes operations of a command process in the memory card 1 with reference to a flowchart in FIG. 8.

[0084] When a command is input from the outside such as a host, the detection section 6 checks the status flag in the area substitution table (step S201) to determine whether or not the status flag indicates the emergency condition of critical value exceeded. The emergency condition occurs when any of area substitution factors in FIG. 5 indicates the limit value. When the emergency condition occurs, the detection section 6 executes a command process for the emergency condition (step S202).

[0085] When no emergency condition occurs, the detection section 6 determines whether or not the status flag (FIG. 4) indicates the IDLE execution in process (step S203). When the IDLE execution in process is determined at step S203, the detection section 6 executes a command process for IDLE execution (step S204). When the IDLE execution in process is not determined at step S203, the detection section 6 processes the externally input command (step S205).

[0086] At step S204 or S205, the detection section 6 checks whether or not any of the area substitution factors in FIG. 5 exceeds the limit value (step S206).

[0087] When the limit value is exceeded, the area decode management section 9 updates the area substitution table for area substitution information (step S207) so that the status flag is set to indicate the emergency condition. Then, the notification section 7 notifies the outside such as the host that the emergency condition takes effect (step S208). The MPU 5 determines whether or not an automatic substitution mode is enabled (step S209). When the automatic substitution mode is enabled, the area substitution is executed (step S210) to terminate the process.

[0088] When it is determined at step S209 that the automatic substitution mode is not enabled, the area substitution is performed according to an instruction of the area substitution command input from the outside such as the host.

[0089] When it is determined at step S206 that the limit value is not exceeded, the detection section 6 checks whether or not any of the area substitution factors exceeds the critical value (step S211).

[0090] When it is determined at step S211 that the critical value is exceeded, the area decode management section 9 updates the area substitution table for the area substitution information (step S212) so that the status flag is set to indicate the IDLE execution. The process then terminates.

[0091] When it is determined at step S211 that the critical value is not exceeded, the MPU 5 checks if an error occurs in the semiconductor memory (step S213). If no error occurs, the process terminates.

[0092] When it is determined at step S213 that an error occurs in the semiconductor memory, the detection section 6 rechecks if any of the area substitution factors exceeds the limit value (step S214). When the limit value is exceeded, the detection section 6 executes the process at steps S207 through S210.

[0093] The process determines the critical value and the limit value at the steps before and after step S213 for the error determination. This is because there may occur a substitution factor during command execution e.g., the current value or the substitute free area in FIG. 5) or a substitution factor due to error contents (e.g., the successive retry error in FIG. 5).

[0094] When it is determined at step S214 that the limit value is not exceeded, the detection section 6 determines whether or not any of the area substitution factors exceeds the critical value (step S215). When the critical value is exceeded, the detection section 6 executes the process at step S212.

[0095] When it is determined at step S215 that the critical value is not exceeded, the detection section detects the retry count (see the successive retry error in FIG. 5) at step S216. When the retry count is greater than or equal to the “preset value minus one”, the error process is executed (step S217).

[0096] When the retry count is smaller than the “preset value minus one”, the retry count is incremented by one (step S218) The process then restarts from step S205.

[0097] The following describes operations of a command process in the emergency condition of the memory card 1 with reference to a flowchart in FIG. 9.

[0098] In the emergency condition, the MPU 5 determines whether or not the automatic substitution mode is enabled (step S301). When the automatic substitution mode is not enabled, the MPU determines whether or not the command is allowed for the emergency condition (step S302). In this example, a command to write or erase the semiconductor memory is assumed to be the command allowed for the emergency condition. Further, it may be preferable to limit the other commands.

[0099] When it is determined at step S302 that the command is allowed for the emergency condition, it is further determined whether or not the command is an area substitution command (step S303). When the command is an area substitution command, the area substitution process is executed (step S304).

[0100] When it is determined at step S303 that the command is not an area substitution command, the other commands are processed (step S305). It is checked whether or not an error occurs in the semiconductor memory (step S306). When no error occurs, the process terminates. When an error occurs, the error is processed (step S307) to terminate the process.

[0101] When it is determined at step S301 that the automatic substitution mode is enabled, the notification section 7 notifies the outside such as the host (step S308) that the emergency condition is effective and the substitution is in process. Then, the process at step S304 is executed.

[0102] The following describes operations of a command process during IDLE execution for the memory card 1 with reference to a flowchart in FIG. 10.

[0103] The area decode management section 9 determines whether or not the area substitution destination is already retrieved (step S401). When the area substitution destination is already retrieved, it is determined whether or not the area substitution destination is substituted (step S402). When the area substitution destination is not substituted, the command is processed at the substitution destination (step S403).

[0104] When it is determined at step S402 that the area substitution destination is substituted, the command is processed at the substitution origin (step S404).

[0105] When the area substitution destination is not retrieved at step S401, MPU 5 retrieves the area substitution destination (step S405). When the substitution destination is available at step S406, the process is executed at step S402 and S403. When the substitution destination is unavailable at step S406, the error process is executed at step S407.

[0106] The following describes a process during IDLE execution for the memory card 1 with reference to a flowchart in FIG. 11.

[0107] During IDLE execution, the MPU 5 detects whether or not there is an interrupt request such as a write or read command from the host (step S501). When there is no interrupt request, the MPU 5 detects whether or not the status flag (FIG. 4) is set to IDLE execution (step S502).

[0108] When the status flag is set to IDLE execution at step S502, the area substitution process is executed (step S503). When the status flag is not set to IDLE execution, the process returns to step S501.

[0109] When an interrupt request is found at step S501, an area substitution in-process history is stored in a work area of the MPU 5 (step S504). Then, the interrupt-requesting command is processed (step S505).

[0110] The area substitution in-process history will now be described with reference to FIG. 12.

[0111]FIG. 12(a) is an explanatory diagram showing a configuration example of the area substitution in-process history that is used as one of pieces of area substitution information and is stored in area substitution information storage areas of the semiconductor memories 3 ₁ and 3 ₂.

[0112] The area substitution in-process history comprises a data section and a management section. The data section stores a plurality of history tables. The history table comprises a physical area number, a start address of substituted area, an end address of substituted area, and a redundant area.

[0113] The physical area number indicates to which physical area number the history data corresponds. The start address of substituted area and the end address of substituted area indicate a substituted area. The redundant area is used to add, e.g., an ECC redundant code but may be omitted.

[0114] The management section stores valid flags corresponding to respective history tables and indicates whether or not the corresponding history table is valid. History table [1] corresponds to valid flag [1]. The valid flag is set to ‘FFh’ when data is written. It is set to ‘00h’ when no data is written.

[0115] Therefore, valid data belongs to the last table that contains the valid flag set to ‘FFh’.

[0116] If a specific area is subject to repeated rewriting or erasing of the history tables and valid flags, a cell in a sector at a specific address is deteriorated. It is necessary to relax an increase in the number of rewrite operations at a specific address in the semiconductor memory due to history updates. For this purpose, eight additional write operations and data storage addresses are changed to disperse the number of erasures (rewrite operations).

[0117] In FIG. 12(a), the process writes data to history table [9] at address ‘n+1’, and then clears data at address ‘n’ where data has been written most recently. Instead, it may be preferable to clear a plurality of blocks at a time.

[0118]FIG. 12(b) exemplifies a configuration of the area substitution in-process history stored in the work area of the MPU 5.

[0119] In this case, the area substitution in-process history comprises a valid table, a physical area number, a start address of substituted area, and an end address of substituted area.

[0120] The valid table indicates a valid history table number instead of the valid flag. The physical area number, the start address of substituted area, and the end address of substituted area are the same as those of the area substitution in-process history stored in the area substitution information storage areas of the semiconductor memories 3 ₁ and 3 ₂.

[0121] An area substitution process in the memory card 1 will now be described with reference to a flowchart in FIG. 13.

[0122] The area decode management section 9 determines whether or not an area substitution destination is already retrieved (step S601). When no area substitution destination is retrieved, the area decode management section 9 retrieves an area substitution destination (step S602). When an area substitution destination is retrieved, the process at steps S604 through S607 (to be described) is executed.

[0123] When an area substitution destination is detected at step S603, the area substitution processing section 8 substitutes the area and saves data and the area decode management section 9 updates area substitution in-process history (step S604).

[0124] In the process at step S604, the area substitution saves data by copying the data from the substitution origin to the substitution destination. When the data contains a correctable error, the error correction is executed. When the error is uncorrectable, the data is copied as is. When the data is substituted in a substitution area at the area substitution origin, the data is copied to the area substitution destination based on the original user area address.

[0125] With respect to the area substitution in-process history, only data in the work area of the MPU 5 is updated. Data is written to the semiconductor memories 3 ₁ and 3 ₂ periodically or at each update.

[0126] The MPU 5 checks whether or not the area substitution terminates normally (step S605). When the area substitution terminates abnormally, the process is repeated from step S602.

[0127] When the area substitution terminates normally, the area decode management section 9 updates the area substitution information (step S606). The notification section 7 notifies the outside such as the host that the area substitution has been executed (step S607). No notification is made when the status flag indicates the IDLE execution. An error is notified when no substitution destination is available.

[0128] When no area substitution destination is detected at step S603, the process ate steps S606 and S607 is executed.

[0129] In this manner, the embodiment can detect, notify, and save an abnormal area in the semiconductor memories 3 ₁ through 3 ₅.

[0130] The areas are configured at physical boundaries controlled by the individual control sections and are saved by avoiding faulty locations including the individual control sections. Consequently, it is possible to greatly improve the reliability of the memory card 1.

[0131] While there have been described specific preferred embodiments of the present invention made by the inventors, it is to be distinctly understood that the present invention is not limited thereto but may be otherwise variously embodied within the spirit and scope of the invention.

[0132] The same value may be predetermined for both the critical value and the limit value. Either the critical value or the limit value may be predetermined. When only the critical value is predetermined, only a process to detect the critical value is executed. When the same value is predetermined for both the critical value and the limit value, or when only the limit value is predetermined, only a process to detect the limit value is executed.

[0133] The specification of the critical value and the limit value is permanently stored as ROM or a circuit in the controller. Alternatively, the specification thereof may be provided as firmware in the flash memory so as to be changeable according to a predetermined procedure. The predetermined value may be loaded into the controller during a reset process, for example.

[0134] According to the configuration of the above-mentioned embodiment, the area substitution information is stored in the generally used semiconductor memory having the user area. As shown in FIG. 14, for example, it may be preferable to provide special semiconductor memory 13 ₅ dedicated to store only the area substitution information in addition to the generally used semiconductor memories 13 ₁ through 13 ₄ to configure a memory card (storage device) 1 a.

[0135] In this case, the inside of the semiconductor memory 13 ₅ comprises: an area substitution information storage area to store the area substitution information; a substitution area to be substituted when the user area fails; and a management area to manage the substitution information.

[0136] This configuration can unify the area substitution information, making it possible to provide easy management of the area substitution information.

[0137] Further, it may be preferable to provide the host or the information processing section with an area (semiconductor memory) to store the area substitution information. Providing the host with the area can simplify processes for the memory card. It is possible to easily diversify processes under control of the OS (Operating System) and drivers.

[0138] Providing the information processing section with the area can submit area substitution processes to the hardware, making it possible to further accelerate processes.

[0139] Moreover, the storage device such as a memory card may be configured as shown in FIG. 15. According to this configuration, a plurality of terminals T is connected to each other via a network NT or a wireless communication. It may be preferable to notify and save the area substitution information that is notified and detected via the network NT.

[0140] The terminal T here is not limited especially and may be personal computers, ATMs (Automatic Teller Machines) at banks, PDAs (Personal Digital Assistants), or any other equivalents having the storage device.

[0141] As shown in FIG. 15, a server SV may be used for centralized management. A relay station BS may be used for distributed management of processes.

[0142] This makes it possible to fast detect and correct an anomaly in the storage device provided for the remote terminal T.

[0143] Furthermore, as shown in FIG. 16, a storage device 14 may comprise an information processing section 15 and a storage section 16. The storage section 16 comprises a plurality of memory modules 16 ₁ through 16 _(n). The memory modules 16 ₁ through 16 _(n) comprise a plurality of semiconductor memories mounted on a printed wiring board.

[0144] In this case, the area substitution is managed in units of memory modules. For example, the memory module 16 ₂ is substituted for the memory module 16 ₄ as the area substitution. The memory module 16 ₂ is identified as the substitution origin (faulty), is removed from a slot St, and is replaced by a new memory module. The area substitution information is stored or updated when a memory module is replaced, for example.

[0145] This makes it possible to greatly improve the maintainability of the storage device 14.

[0146] The following summarizes representative advantageous effects of the invention disclosed in this application concerned.

[0147] (1) When the semiconductor memory contains an abnormal area, that area is detected and substituted on two levels: the critical state and the limit state. It is possible to improve the reliability of the storage device.

[0148] (2) Physical areas are used for semiconductor memory areas to save data by avoiding faulty locations including peripheral circuits. It is possible to further improve the reliability of the storage device.

[0149] (3) Still further, it is possible to greatly improve the performance and the reliability of electronic devices comprising the storage device and the like owing to the advantages (1) and (2). 

What is claimed is:
 1. A storage device comprising one or more semiconductor memories and an information processing section which reads data stored in the one or more semiconductor memories based on an operating program and instructs a predetermined process and an operation to write data, wherein the information processing section detects a state of an area in the semiconductor memory, substitutes the area during an idle state causing no operations in the storage device when the area is assumed to be a critical state, and substitutes the area immediately when the area is assumed to be a limit state.
 2. The storage device according to claim 1, wherein a factor for the information processing section to determine a critical state comprises one or more of an insufficiency of a substitute free area, a successive retry error, a time over of an erasure time or a program time, an erasure count, an over current of performing a read operation or a write operation, and a less current value of externally supplied power; and wherein a factor for the information processing section to determine a limit state comprises one or more of an insufficiency of a substitute free area, a successive retry error, an ECC uncorrectable error at retention failure, a device code unreadable error, a time over of an erasure time or a program time, an erasure count, an over current of performing a read operation or a write operation, and a less current value of externally supplied power.
 3. The storage device according to claim 2 capable of independently setting the factors for the information processing section to determine a critical state and setting the factors for the information processing section to determine a limit state.
 4. The storage device according to claim 3, wherein a substitution destination area substituted by the information processing section is a free area in the semiconductor memory or semiconductor memory for substitution only.
 5. The storage device according to claim 4, wherein, when the substitution destination area is a free area in the semiconductor memory, the substitution destination area is a physical area controlled by an individual peripheral circuit which controls any of a plurality of sectors provided for a memory mat.
 6. The storage device according to claim 5, wherein a decode method of the device substitutes only data in a substitution origin area for data in a substitution destination area, after substitution, allows access to the substitution destination area instead of the substituted area, and allows access to an unsubstituted area in the same manner as before the substitution.
 7. The storage device according to claim 1, wherein the information processing section notifies an outside of an emergency condition when determining that the area is in a limit state.
 8. The storage device according to claim 7, wherein restricting operations such as inhibiting a write operation are performed in the limit state.
 9. The storage device according to claim 8, wherein the information processing section copies data from a substitution origin area to a substitution destination area during the area substitution and corrects a correctable error if it is contained in the data.
 10. The storage device according to claim 9 comprising: a detection circuit for detecting an area state; a notification circuit for notifying an outside of a detection result and an area substitution state; an area substitution circuit for performing area substitution; and an area decode management circuit for managing permission or inhibition of access to areas. 